<?php
$root = realpath($_SERVER["DOCUMENT_ROOT"]) . "/SmartTuition/SmartTuition.Model"; 
// includes
require_once("$root/Abstraction/IRepository.php");
require_once("$root/Concrete/DBContext.php");
require_once("$root/Models/Group.php");

class GroupRepository implements IRepository
{
    public function GetAll() {
        return DBContext::Instance()->GetFromTable("group","*");
    }
    public function GetById($id) {
        return DBContext::Instance()->GetFromTable("group","*", "where GroupID=$id");
    }
    public function DeleteById($id) {
        DBContext::Instance()->DeleteFromTable("group","GroupID",$id);
    }
    public function Delete(EntityWithID $ent) {
        DBContext::Instance()->DeleteFromTable("group","GroupID", $ent->getId());
    }
    public function Update(EntityWithID $entity) {
        DBContext::Instance()->UpdateTableRecord("group", $entity->getColumns(), $entity->getValues(), "GroupID",$entity->getId());
    }
    public function Insert(EntityWithID $entity) {
        DBContext::Instance()->InsertIntoTable("group",$entity->getColumns(),$entity->getValues());
    }
}